import { _decorator, Color, Component, MeshRenderer, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('TankRenderers')
export class TankRenderers extends Component {

    @property(Node)
    public renderesNode: Node;

    public playerColor: Color;


    public renderColor(){

        const renderers = this.renderesNode.getComponentsInChildren(MeshRenderer);
        for (let i = 0; i < renderers.length; i++) {
            const material = renderers[i].material;
            if (material) {
                material.setProperty('mainColor', this.playerColor);
            }
        }
    }
}

